package com.share.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.share.dao.BaseDao;

/**
 * @author caifan
 *
 * 2015年3月29日
 */
@Service
public class ShiroService {
	@Autowired
	BaseDao baseDao;
	
	/**
	 * 根据角色id获取对应的权限id
	 * @param roleid
	 * @return
	 */
	/*public List<Map<String, Object>> getPermissions(int roleid) {
		String sql = "select * from role_permission where role_id=?";
		return baseDao.queryList(sql, roleid);
	}*/
	
	/**
	 * 通过用户id获取角色
	 * @param userid
	 * @return
	 */
	/*public List<Map<String, Object>> getRoles(int userid){
		String sql = "select * from role where id in (select role_id from user_role where user_id=?)";
		return baseDao.queryList(sql, userid);
	}*/
	
	/**
	 * 添加权限id
	 * @param permid
	 */
	/*public void addPerm(int permid) {
		String sql = "insert into role_permission";
	}*/
	
	/**
	 * 查询所有的权限
	 * @param role
	 * @return
	 */
	/*public List<Map<String, Object>> getPermissions(Role role) {
		String sql = "select * from permission where id in (SELECT permission_id from role_permission WHERE role_id=?)";
		return baseDao.queryList(sql, role.getId());
	} */
	
	/**
	 * 查询所有的角色
	 * @param user
	 * @return
	 */
	/*public List<Map<String, Object>> getRoles(User user) {
		String sql = "select * from role where id in (select role_id from user_role where user_id=?)";
		return baseDao.queryList(sql, user.getId());
	}*/
}
